Honor disable_fsync during checkout also
authorVadim Rutkovsky <vrutkovs@redhat.com>
Tue, 3 Jun 2014 23:40:32 +0000 (01:40 +0200)
committerVadim Rutkovsky <vrutkovs@redhat.com>
Wed, 4 Jun 2014 14:14:46 +0000 (16:14 +0200)
Finally, fsync to ensure all entries are on disk, unless disabled.
 We support disabling this for cases like server-side buildroot
 construction where we don't need to be robust against power loss

src/libostree/ostree-repo-checkout.c

index 7bf832895e2c85d4c66b3bf112ec97ace5d73358..417e11f6b8a2d57c4e747f21e409139b12582671 100644 (file)
@@ -661,10 +661,13 @@ checkout_tree_at (OstreeRepo                        *self,
    * this should be configurable for the case where we're constructing
    * buildroots.
    */
-  if (fsync (destination_dfd) == -1)
+  if (!self->disable_fsync)
     {
-      ot_util_set_error_from_errno (error, errno);
-      goto out;
+    if (fsync (destination_dfd) == -1)
+      {
+        ot_util_set_error_from_errno (error, errno);
+        goto out;
+      }
     }
 
   ret = TRUE;